package neves.android.etmg.sprite;

public class Creature extends GameSprite {

	private static final int STATE_NORMAL = 0;
	private static final int STATE_DEAD = 0;
	
	private int maxTrackCount = 10 ;
	private int trackPlayerCount = 0;
	
	private int state;
	
	private int MaxHP;
	private int HP;    // it's Health Point
	private int DEF;   // defence power
	private int ATT;   // attact power
	
	
	public Creature(String newName, int maxHP, int initHP, int defPow, int attPow, int sprType) {
		super(newName, sprType);
		
		MaxHP = maxHP;
		
		HP = initHP;
		
		DEF = defPow;
		
		ATT = attPow;
		
		state = STATE_NORMAL;
		
		// TODO Auto-generated constructor stub
	}
	
	public int CreatureState(){
		return state;
	}

	public void AddHP( int healHP){
		HP += healHP;
		if(HP>MaxHP){
			HP = MaxHP;
		}
	}
	
	public void MakeWound(int woundHP){
		
		HP -= woundHP;
		
		if(HP<=0){
			state = STATE_DEAD;
		}
	}
	
	public int GetDefencePower(){
		return DEF;
	}
	
	public int GetAttactPower(){
		return ATT;
	}
	
	public boolean IsAlive(){
		return (state==STATE_DEAD?false:true);
	}
	
	
	
	///
	///  Track Player Use
	///
	public void SetMaxTrackCount(int max){
		maxTrackCount = max;
	}
	
	public void UpdateTrackCount(){
		trackPlayerCount = maxTrackCount;
	}
	
	public void DecayTrackCount(){
		if(trackPlayerCount>0){
			trackPlayerCount--;
		}
	}
	
	public boolean IsTracking(){
		if(trackPlayerCount>0){
			return true;
		}
		return false;
	}
}
